<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    : void
    {
        Schema::create('qnr',function(Blueprint $table) {

            $table->charset = 'utf8mb4';

            $table->collation = 'utf8mb4_unicode_ci';

            // 数据类型
            $table->engine = 'InnoDB';

            $table->comment('问卷表');

            $table->bigIncrements('id');
            $table->uuid('qnr_id')->unique()->nullable(false);
            $table->string('admin_id')->nullable(false)->comment('创建者');
            $table->uuid('c_key')->nullable(false);
            $table->text('t_key')->nullable()->comment('关键词');
            $table->string('slug',255)->nullable(false)->comment('翻译URL标题，友好的SEO链接');
            $table->string('title',125)->unique()->nullable(false);
            $table->longText('content')->nullable(false)->comment('活动内容');
            $table->text('introduction')->nullable()->comment('活动简介');
            $table->string('address',85)->nullable()->comment('地址');
            $table->string('tel_phone',35)->nullable()->comment('联系电话');
            $table->string('sponsor',85)->nullable()->comment('主办方或者赞助商');
            $table->longText('options')->nullable()->comment('问卷配置内容');
            $table->longText('images')->nullable()->comment('图片集合');
            $table->string('thumbnail',255)->nullable();
            $table->smallInteger('is_top')->nullable()->unsigned()->default(0)->comment('置顶');
            $table->smallInteger('is_using')->nullable()->unsigned()->default(1)->comment('状态');
            $table->smallInteger('is_comments')->nullable()->unsigned()->default(1)->comment('评论');
            $table->timestamps();

            $table->index('qnr_id');
            $table->index('admin_id');
            $table->index('title');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('qnr');
    }
};
